home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / hard / drivr / cyberx10.lha / CyberX10 / Source / myprintf.c < prev    next >
Text File  |  1992-11-06  |  1KB  |  56 lines

  1. BOOL ErrorsToEzReq = FALSE;
  2.  
  3. static void HandleMsgReq(LONG fmt, va_list args, STRPTR ReqTitle, STRPTR CLITitle);
  4.  
  5. void __stdargs ErrorMsg(LONG fmt,...)
  6. {
  7.     va_list args;
  8.  
  9.     va_start(args, fmt);
  10.     HandleMsgReq(fmt, args, GetString(&LocaleInfo, MSG_ERROR_REQ_WIN_TITLE), PROGNAME);
  11.     va_end(args);
  12. }
  13.  
  14. void __stdargs MyPrintf(LONG fmt,...)
  15. {
  16.     va_list args;
  17.  
  18.     va_start(args, fmt);
  19.     HandleMsgReq(fmt, args, PROGNAME, NULL);
  20.     va_end(args);
  21. }
  22.  
  23. static void HandleMsgReq(LONG fmt, va_list args, STRPTR ReqTitle, STRPTR CLITitle)
  24. {
  25.     struct IntuitionBase *IntuitionBase;
  26.     ULONG my_IDCMP;
  27.     struct EasyStruct ezRequest;
  28.  
  29.     if (ErrorsToEzReq) {
  30.         /* grab intuition, do an EasyRequest and then free intuition */
  31.         if (IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 37L)) {
  32.             ezRequest.es_StructSize = sizeof(struct EasyStruct);
  33.             ezRequest.es_Flags = 0;
  34.             ezRequest.es_Title = ReqTitle;
  35.             ezRequest.es_TextFormat = GetString(&LocaleInfo, fmt);
  36.             ezRequest.es_GadgetFormat = GetString(&LocaleInfo, MSG_CONTINUE);
  37.  
  38.             my_IDCMP = 0L;
  39.  
  40.             EasyRequestArgs((struct Window *) NULL, &ezRequest, &my_IDCMP, args);
  41.  
  42.             CloseLibrary((struct Library *) IntuitionBase);
  43.         }
  44.     }
  45.     else {
  46.         if (CLITitle) {
  47.             PutStr(CLITitle);
  48.             PutStr(": ");
  49.         }
  50.  
  51.         VPrintf(GetString(&LocaleInfo, fmt), (LONG *) args);
  52.         PutStr("\n");
  53.         Flush(Output());
  54.     }
  55. }
  56.